<HTML>
<HEAD>
<TITLE>FDJS Linked input example</TITLE>

<script src="fdjs.js"></script>

<script language="JavaScript1.2">

//////////////////////////////////////////////////////////////////
//
//   FDJS Linked input Example
//   (c) Kerry Clendinning, 2007
//
//   This is a simple example to demonstrate functional declarative
//   programming in javascript, using the FDJS libary.
//
//   Licensed under the Mozilla Public License 1.1
//   http://www.mozilla.org/MPL/
//
//   This header must remain intact.
//
//   Project homepage http://code.google.com/p/fdjs/
//
//////////////////////////////////////////////////////////////////

  function linked_inputs_example() {
     textinput = new FDJSValue( RED_BLUE, "value", function () { 
            return menuinput.getValue() }, "onchange" )
     menuinput = new FDJSValue( TEXT_IN, "value", function () { 
            return textinput.getValue() }, "onchange" )

     FDJSValue.prototype.dependTracker.detect( )
  }

</script>
  
</HEAD>
<BODY onload="linked_inputs_example(); return false">
<B>Linked inputs example</B><BR>
    <SELECT ID="RED_BLUE">
       <OPTION VALUE="red">red</OPTION>
       <OPTION VALUE="blue">blue</OPTION>
    </SELECT>
<BR>
    <INPUT ID="TEXT_IN" VALUE="red" SIZE="4"/>Type red or blue and hit tab
<P>
  <INPUT TYPE=SUBMIT ONCLICK="FDJSValue.prototype.setLogger( 'EVENTLOG' )" VALUE="Log Events"/>
  <PRE ID="EVENTLOG"></PRE>

<P>
<B>Source for the example above</B>
<PRE>

&lt;HEAD&gt;
&lt;script src="fdjs.js"&gt;&lt;/script&gt;

&lt;script language="JavaScript1.2"&gt;
  function linked_inputs_example() {
     textinput = new FDJSValue( RED_BLUE, "value", function () { return menuinput.getValue() }, "onchange" )
     menuinput = new FDJSValue( TEXT_IN, "value", function () { return textinput.getValue() }, "onchange" )
     FDJSValue.prototype.dependTracker.detect( )
  }
&lt;/script&gt;
  
&lt;/HEAD&gt;
&lt;BODY onload="linked_inputs_example(); return false"&gt;
&lt;B&gt;Linked inputs example&lt;/B&gt;&lt;BR&gt;
    &lt;SELECT ID="RED_BLUE"&gt;
       &lt;OPTION VALUE="red"&gt;red&lt;/OPTION&gt;
       &lt;OPTION VALUE="blue"&gt;blue&lt;/OPTION&gt;
    &lt;/SELECT&gt;
&lt;BR&gt;
    &lt;INPUT ID="TEXT_IN" VALUE="red" SIZE="4"&gt;Type red or blue and hit tab
&lt;P&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;

</PRE>

</BODY>
</HTML>
